%%ERGASTHRIO 1
%%ONOMA:ГйЬкб Чсхупэлб
%%AEM:764
%%TMHMA:1
%%EMAIL:chrgiaka@uth.gr


%------------------------------------------------------------------------
%ASKHSH 1
%Oriste ena dianysma y me 18 stoixeia, pou kaqe tou stoixeio einai iso me to 
%triplasio ths qeshs toy meion 9.
%------------------------------------------------------------------------
yindex=[1:1:18];
y=yindex*3-9

%------------------------------------------------------------------------
%ASKHSH 2
%Ypologiste th 2h dynamh twn stoixeiwn tou y.
%------------------------------------------------------------------------
d = y.^2

%-----------------------------------------------------------------------
%ASKHSH 3
%Ypologiste to eswteriko ginomeno tou dianysmatos x me ton eayto tou
%-----------------------------------------------------------------------

%Estw x=[1 3 4 6];
x=[1 3 4 6];
eg=x*x'

%-----------------------------------------------------------------------
%ASKHSH 4
%Ypologiste thn eykleidia norma tou x xrhsimopoiwntas thn synarthsh norm.
%Ti sxesh exei to nor2 me thn timh ths eg?
%-----------------------------------------------------------------------

nor2 = norm(x,2)

%nor2^2=eg=x*x'
%To nor2 kai to sqrt(eg)exoun sxesi giati nor2=sqrt(eg) 


%-----------------------------------------------------------------------
%ASKHSH 5 
%Kante th grafikh parastash twn zevgariwn (y(i),d(i)), i=1,2,3,....
%-----------------------------------------------------------------------

hold on

xlabel('times dianismatos y')
ylabel('times dianismatos d')
title('i grafiki parastasi tou d ws pros y')
axis([-6 45 0 2025])

plot(y,d)
plot(y,d,'*g')

hold off




